#include "VertexLightingRender.h"
#include <cassert>

VertexLightRender::VertexLightRender(const std::string& name) :IRender(name)
{
	mHandle = ShaderManager::Instance()->CreateShader(SID_SAMPLE_VERTEX_LIGHTING);
	ShaderManager::Instance()->LoadShader(mHandle);
	mHandleVertex = ShaderManager::Instance()->CreateShader(SID_SAMPLE_10_VERTEX);
	ShaderManager::Instance()->LoadShader(mHandleVertex);
	mHandleFragFragment = ShaderManager::Instance()->CreateShader(SID_SAMPLE_10_FRAGMENT_LIGHTING);
	ShaderManager::Instance()->LoadShader(mHandleFragFragment);
	mHandleDoubleLightVertex = ShaderManager::Instance()->CreateShader(SID_SAMPLE_11_VERTEX);
	ShaderManager::Instance()->LoadShader(mHandleDoubleLightVertex);
	mHandleAttenuationVertex = ShaderManager::Instance()->CreateShader(SID_SAMPLE_12_VERTEX);
	ShaderManager::Instance()->LoadShader(mHandleAttenuationVertex);
	mHandleAttenuationFragment = ShaderManager::Instance()->CreateShader(SID_SAMPLE_12_FRAGMENT);
	ShaderManager::Instance()->LoadShader(mHandleAttenuationFragment);
	mHandleSpotLightVertex = ShaderManager::Instance()->CreateShader(SID_SAMPLE_13_VERTEX);
	ShaderManager::Instance()->LoadShader(mHandleSpotLightVertex);
	mHandleSpotLightFragment = ShaderManager::Instance()->CreateShader(SID_SAMPLE_13_FRAGMENT);
	ShaderManager::Instance()->LoadShader(mHandleSpotLightFragment);

	glPushMatrix();

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef(-2.0, -1.5, 0);
	glRotatef(-90, 1, 0, 0);
	glGetFloatv(GL_MODELVIEW_MATRIX, mModelMatrixPlastic);

	glLoadIdentity();
	glTranslatef(2, 0, 0);
	glRotatef(70, 1, 1, 1);
	glGetFloatv(GL_MODELVIEW_MATRIX, mModelBrass);

	glLoadIdentity();
	glGetFloatv(GL_MODELVIEW_MATRIX, mModelFloor);

	glLoadIdentity();
	gluLookAt(0, 0, 13, 0, 0, 0, 0, 1, 0);
	glGetFloatv(GL_MODELVIEW_MATRIX, mViewMatrix);

	float projectMatrix[16];

	glLoadIdentity();
	gluPerspective(40, 1, 1, 100);
	glGetFloatv(GL_MODELVIEW_MATRIX, projectMatrix);

	glLoadMatrixf(projectMatrix);
	glMultMatrixf(mViewMatrix);
	glMultMatrixf(mModelMatrixPlastic);
	glGetFloatv(GL_MODELVIEW_MATRIX, mPlasticMVP);

	glLoadMatrixf(projectMatrix);
	glMultMatrixf(mViewMatrix);
	glMultMatrixf(mModelBrass);
	glGetFloatv(GL_MODELVIEW_MATRIX, mBrassMVP);

	glLoadMatrixf(projectMatrix);
	glMultMatrixf(mViewMatrix);
	glGetFloatv(GL_MODELVIEW_MATRIX, mModelFloorMVP);

	glPopMatrix();

	for (int i = 0; i < 16; ++i)
	{
		mMaterialPlastic[i] = 0;
		mMaterialBrass[i] = 0;
		mMaterialEmelrad[i] = 0;
	}
	mMaterialPlastic[8] = 0.5;//kd
	mMaterialPlastic[12] = 0.7; mMaterialPlastic[13] = 0.6; mMaterialPlastic[14] = 0.6;//ks
	mMaterialPlastic[15] = 32;

	mMaterialBrass[4] = 0.33; mMaterialBrass[5] = 0.22; mMaterialBrass[6] = 0.03;
	mMaterialBrass[8] = 0.78; mMaterialBrass[9] = 0.57; mMaterialBrass[10] = 0.11;
	mMaterialBrass[12] = 0.99; mMaterialBrass[13] = 0.91; mMaterialBrass[14] = 0.81;//ks
	mMaterialBrass[15] = 27.8;

	mMaterialEmelrad[4] = 0.0215; mMaterialEmelrad[5] = 0.1745; mMaterialEmelrad[6] = 0.0215;
	mMaterialEmelrad[8] = 0.07568; mMaterialEmelrad[9] = 0.61424; mMaterialEmelrad[10] = 0.07568;
	mMaterialEmelrad[12] = 0.633; mMaterialEmelrad[13] = 0.727811; mMaterialEmelrad[14] = 0.633;
	mMaterialEmelrad[15] = 76.8;

	glViewport(0, 0, 400, 400);
}

VertexLightRender::~VertexLightRender()
{

}

void VertexLightRender::idle()
{

}

void VertexLightRender::draw()
{
	//draw_vertex_lighting();
	//draw_fragment_lighting();
	//draw_double_vertex_lights();
	//draw_attenuation();
	draw_spotlight();
}

void VertexLightRender::draw_vertex_lighting()
{
	ShaderManager::Instance()->BindShader(mHandle);
	ShaderManager::Instance()->EnableShaderProfile(mHandle);
	CGprogram vertexProgram = ShaderManager::Instance()->GetProgram(mHandle);
	CGparameter mvp = cgGetNamedParameter(vertexProgram, "mvp");
	CGparameter m = cgGetNamedParameter(vertexProgram, "modelMatrix");
	CGparameter material = cgGetNamedParameter(vertexProgram, "material");

	cgSetMatrixParameterfr(mvp, mPlasticMVP);
	cgSetMatrixParameterfr(m, mModelMatrixPlastic);
	cgSetMatrixParameterfr(material, mMaterialPlastic);
	cgUpdateProgramParameters(vertexProgram);
	glutSolidCone(1.5, 3.5, 30, 30);

	cgSetMatrixParameterfr(mvp, mBrassMVP);
	cgSetMatrixParameterfr(m, mModelBrass);
	cgSetMatrixParameterfr(material, mMaterialBrass);
	cgUpdateProgramParameters(vertexProgram);
	glutSolidSphere(2.0, 40, 40);

	ShaderManager::Instance()->DisableShaderProfile(mHandle);
	ShaderManager::Instance()->UnBindShader(mHandle);
}

void VertexLightRender::draw_fragment_lighting()
{
	ShaderManager::Instance()->BindShader(mHandleVertex);
	ShaderManager::Instance()->EnableShaderProfile(mHandleVertex);
	CGprogram vertexProgram = ShaderManager::Instance()->GetProgram(mHandleVertex);
	CGparameter mvp = cgGetNamedParameter(vertexProgram, "mvp");
	CGparameter m = cgGetNamedParameter(vertexProgram, "modelMatrix");

	ShaderManager::Instance()->BindShader(mHandleFragFragment);
	ShaderManager::Instance()->EnableShaderProfile(mHandleFragFragment);
	CGprogram fragmentProgram = ShaderManager::Instance()->GetProgram(mHandleFragFragment);
	CGparameter material = cgGetNamedParameter(fragmentProgram, "material");

	
	cgSetMatrixParameterfr(mvp, mPlasticMVP);
	cgSetMatrixParameterfr(m, mModelMatrixPlastic);
	cgUpdateProgramParameters(vertexProgram);
	cgSetMatrixParameterfr(material, mMaterialPlastic);
	cgUpdateProgramParameters(fragmentProgram);
	glutSolidCone(1.5, 3.5, 30, 30);

	cgSetMatrixParameterfr(mvp, mBrassMVP);
	cgSetMatrixParameterfr(m, mModelBrass);
	cgUpdateProgramParameters(vertexProgram);
	cgSetMatrixParameterfr(material, mMaterialBrass);
	cgUpdateProgramParameters(fragmentProgram);
	glutSolidSphere(2.0, 40, 40);

	ShaderManager::Instance()->UnBindShader(mHandleFragFragment);
	ShaderManager::Instance()->DisableShaderProfile(mHandleFragFragment);

	ShaderManager::Instance()->DisableShaderProfile(mHandleVertex);
	ShaderManager::Instance()->UnBindShader(mHandleVertex);
}

void VertexLightRender::draw_double_vertex_lights()
{
	ShaderManager::Instance()->BindShader(mHandleDoubleLightVertex);
	ShaderManager::Instance()->EnableShaderProfile(mHandleDoubleLightVertex);
	CGprogram vertexProgram = ShaderManager::Instance()->GetProgram(mHandleDoubleLightVertex);
	CGparameter mvp = cgGetNamedParameter(vertexProgram, "mvp");
	CGparameter m = cgGetNamedParameter(vertexProgram, "modelMatrix");
	CGparameter ke = cgGetNamedParameter(vertexProgram, "material.ke");
	CGparameter ka = cgGetNamedParameter(vertexProgram, "material.ka");
	CGparameter kd = cgGetNamedParameter(vertexProgram, "material.kd");
	CGparameter ks = cgGetNamedParameter(vertexProgram, "material.ks");
	CGparameter shiness = cgGetNamedParameter(vertexProgram, "material.shiness");
	CGparameter ambient = cgGetNamedParameter(vertexProgram, "globalAmbient");
	CGparameter light0_pos = cgGetNamedParameter(vertexProgram, "lights[0].pos");
	CGparameter light0_color = cgGetNamedParameter(vertexProgram, "lights[0].color");
	CGparameter light1_pos = cgGetNamedParameter(vertexProgram, "lights[1].pos");
	CGparameter light1_color = cgGetNamedParameter(vertexProgram, "lights[1].color");
	CGparameter eyePosition = cgGetNamedParameter(vertexProgram, "eyePosition");

	cgSetParameter3f(ambient, 0.1, 0.1, 0.1);
	cgSetParameter3f(light0_pos, 5 * sin(-0.4), 1.5, 5 * cos(-0.4));
	cgSetParameter3f(light0_color, 0.95, 0.95, 0.95);
	cgSetParameter3f(light1_pos, 5 * sin(-0.1), 0.25, 5 * cos(-0.1));
	cgSetParameter3f(light1_color, 0.5, 0.5, 0.2);
	cgSetParameter3f(eyePosition, 0, 0, 13);

	cgSetMatrixParameterfr(mvp, mPlasticMVP);
	cgSetMatrixParameterfr(m, mModelMatrixPlastic);
	cgSetParameter3f(ke, mMaterialPlastic[0], mMaterialPlastic[1], mMaterialPlastic[2]);
	cgSetParameter3f(ka, mMaterialPlastic[4], mMaterialPlastic[5], mMaterialPlastic[6]);
	cgSetParameter3f(kd, mMaterialPlastic[8], mMaterialPlastic[9], mMaterialPlastic[10]);
	cgSetParameter3f(ks, mMaterialPlastic[12], mMaterialPlastic[13], mMaterialPlastic[14]);
	cgSetParameter1f(shiness, mMaterialPlastic[15]);
	cgUpdateProgramParameters(vertexProgram);
	glutSolidCone(1.5, 3.5, 30, 30);

	cgSetMatrixParameterfr(mvp, mBrassMVP);
	cgSetMatrixParameterfr(m, mModelBrass);
	cgSetParameter3f(ke, mMaterialBrass[0], mMaterialBrass[1], mMaterialBrass[2]);
	cgSetParameter3f(ka, mMaterialBrass[4], mMaterialBrass[5], mMaterialBrass[6]);
	cgSetParameter3f(kd, mMaterialBrass[8], mMaterialBrass[9], mMaterialBrass[10]);
	cgSetParameter3f(ks, mMaterialBrass[12], mMaterialBrass[13], mMaterialBrass[14]);
	cgSetParameter1f(shiness, mMaterialBrass[15]);
	cgUpdateProgramParameters(vertexProgram);
	glutSolidSphere(2.0, 40, 40);

	ShaderManager::Instance()->DisableShaderProfile(mHandleDoubleLightVertex);
	ShaderManager::Instance()->UnBindShader(mHandleDoubleLightVertex);
}

void VertexLightRender::draw_attenuation()
{
	ShaderManager::Instance()->BindShader(mHandleAttenuationVertex);
	ShaderManager::Instance()->EnableShaderProfile(mHandleAttenuationVertex);
	CGprogram vertexProgram = ShaderManager::Instance()->GetProgram(mHandleAttenuationVertex);
	CGparameter mvp = cgGetNamedParameter(vertexProgram, "mvp");
	CGparameter m = cgGetNamedParameter(vertexProgram, "modelMatrix");

	ShaderManager::Instance()->BindShader(mHandleAttenuationFragment);
	ShaderManager::Instance()->EnableShaderProfile(mHandleAttenuationFragment);
	CGprogram fragmentProgram = ShaderManager::Instance()->GetProgram(mHandleAttenuationFragment);
	CGparameter ke = cgGetNamedParameter(fragmentProgram, "material.ke");
	CGparameter ka = cgGetNamedParameter(fragmentProgram, "material.ka");
	CGparameter kd = cgGetNamedParameter(fragmentProgram, "material.kd");
	CGparameter ks = cgGetNamedParameter(fragmentProgram, "material.ks");
	CGparameter shiness = cgGetNamedParameter(fragmentProgram, "material.shiness");
	CGparameter ambient = cgGetNamedParameter(fragmentProgram, "globalAmbient");
	CGparameter light0_pos = cgGetNamedParameter(fragmentProgram, "lights[0].pos");
	CGparameter light0_color = cgGetNamedParameter(fragmentProgram, "lights[0].color");
	CGparameter light0_kc = cgGetNamedParameter(fragmentProgram, "lights[0].kC");
	CGparameter light0_kl = cgGetNamedParameter(fragmentProgram, "lights[0].kL");
	CGparameter light0_kq = cgGetNamedParameter(fragmentProgram, "lights[0].kQ");
	cgSetParameter1f(light0_kc, 0.4f);
	cgSetParameter1f(light0_kl, 0.1f);
	cgSetParameter1f(light0_kq, 0.03f);
	CGparameter light1_pos = cgGetNamedParameter(fragmentProgram, "lights[1].pos");
	CGparameter light1_color = cgGetNamedParameter(fragmentProgram, "lights[1].color");
	CGparameter light1_kc = cgGetNamedParameter(fragmentProgram, "lights[1].kC");
	CGparameter light1_kl = cgGetNamedParameter(fragmentProgram, "lights[1].kL");
	CGparameter light1_kq = cgGetNamedParameter(fragmentProgram, "lights[1].kQ");
	cgSetParameter1f(light1_kc, 0.4f);
	cgSetParameter1f(light1_kl, 0.1f);
	cgSetParameter1f(light1_kq, 0.03f);

	CGparameter eyePosition = cgGetNamedParameter(fragmentProgram, "eyePosition");

	cgSetParameter3f(ambient, 0.5, 0.5, 0.5);
	cgSetParameter3f(light0_pos, 5 * sin(-0.4),1.5,5 * cos(-0.4));
	cgSetParameter3f(light0_color,1,1, 1);
	cgSetParameter3f(light1_pos, 5 * sin(-0.1), 0.25, 5 * cos(-0.1));
	cgSetParameter3f(light1_color, 0.5, 0.5, 0.2);
	cgSetParameter3f(eyePosition, 0, 0, 13);

	cgSetMatrixParameterfr(mvp, mPlasticMVP);
	cgSetMatrixParameterfr(m, mModelMatrixPlastic);
	cgSetParameter3f(ke, mMaterialPlastic[0], mMaterialPlastic[1], mMaterialPlastic[2]);
	cgSetParameter3f(ka, mMaterialPlastic[4], mMaterialPlastic[5], mMaterialPlastic[6]);
	cgSetParameter3f(kd, mMaterialPlastic[8], mMaterialPlastic[9], mMaterialPlastic[10]);
	cgSetParameter3f(ks, mMaterialPlastic[12], mMaterialPlastic[13], mMaterialPlastic[14]);
	cgSetParameter1f(shiness, mMaterialPlastic[15]);
	cgUpdateProgramParameters(vertexProgram);
	cgUpdateProgramParameters(fragmentProgram);
	glutSolidCone(1.5, 3.5, 30, 30);

	cgSetMatrixParameterfr(mvp, mBrassMVP);
	cgSetMatrixParameterfr(m, mModelBrass);
	cgSetParameter3f(ke, mMaterialBrass[0], mMaterialBrass[1], mMaterialBrass[2]);
	cgSetParameter3f(ka, mMaterialBrass[4], mMaterialBrass[5], mMaterialBrass[6]);
	cgSetParameter3f(kd, mMaterialBrass[8], mMaterialBrass[9], mMaterialBrass[10]);
	cgSetParameter3f(ks, mMaterialBrass[12], mMaterialBrass[13], mMaterialBrass[14]);
	cgSetParameter1f(shiness, mMaterialBrass[15]);
	cgUpdateProgramParameters(vertexProgram);
	cgUpdateProgramParameters(fragmentProgram);
	glutSolidSphere(2.0, 40, 40);

	cgSetMatrixParameterfr(mvp, mModelFloorMVP);
	cgSetMatrixParameterfr(m, mModelFloor);
	cgSetParameter3f(ke, mMaterialEmelrad[0], mMaterialEmelrad[1], mMaterialEmelrad[2]);
	cgSetParameter3f(ka, mMaterialEmelrad[4], mMaterialEmelrad[5], mMaterialEmelrad[6]);
	cgSetParameter3f(kd, mMaterialEmelrad[8], mMaterialEmelrad[9], mMaterialEmelrad[10]);
	cgSetParameter3f(ks, mMaterialEmelrad[12], mMaterialEmelrad[13], mMaterialEmelrad[14]);
	cgSetParameter1f(shiness, mMaterialEmelrad[15]);
	cgUpdateProgramParameters(vertexProgram);
	cgUpdateProgramParameters(fragmentProgram);
	glBegin(GL_QUADS);
	glNormal3f(0, 1, 0);
	glVertex3f(12, -2, -12);
	glVertex3f(-12, -2, -12);
	glVertex3f(-12, -2, 12);
	glVertex3f(12, -2, 12);

	glNormal3f(0, 0, 1);
	glVertex3f(-12, -2, -12);
	glVertex3f(12, -2, -12);
	glVertex3f(12, 10, -12);
	glVertex3f(-12, 10, -12);

	glNormal3f(0, -1, 0);
	glVertex3f(-12, 10, -12);
	glVertex3f(12, 10, -12);
	glVertex3f(12, 10, 12);
	glVertex3f(-12, 10, 12);

	glNormal3f(1, 0, 0);
	glVertex3f(-12, -2, 12);
	glVertex3f(-12, -2, -12);
	glVertex3f(-12, 10, -12);
	glVertex3f(-12, 10, 12);

	glNormal3f(-1, 0, 0);
	glVertex3f(12, -2, -12);
	glVertex3f(12, -2, 12);
	glVertex3f(12, 10, 12);
	glVertex3f(12, 10, -12);
	glEnd();

	ShaderManager::Instance()->DisableShaderProfile(mHandleAttenuationFragment);
	ShaderManager::Instance()->UnBindShader(mHandleAttenuationFragment);

	ShaderManager::Instance()->DisableShaderProfile(mHandleAttenuationVertex);
	ShaderManager::Instance()->UnBindShader(mHandleAttenuationVertex);
}

void VertexLightRender::draw_spotlight()
{
	ShaderManager::Instance()->BindShader(mHandleSpotLightVertex);
	ShaderManager::Instance()->EnableShaderProfile(mHandleSpotLightVertex);
	CGprogram vertexProgram = ShaderManager::Instance()->GetProgram(mHandleSpotLightVertex);
	CGparameter mvp = cgGetNamedParameter(vertexProgram, "mvp");
	CGparameter m = cgGetNamedParameter(vertexProgram, "modelMatrix");

	ShaderManager::Instance()->BindShader(mHandleSpotLightFragment);
	ShaderManager::Instance()->EnableShaderProfile(mHandleSpotLightFragment);
	CGprogram fragmentProgram = ShaderManager::Instance()->GetProgram(mHandleSpotLightFragment);
	CGparameter ke = cgGetNamedParameter(fragmentProgram, "material.ke");
	CGparameter ka = cgGetNamedParameter(fragmentProgram, "material.ka");
	CGparameter kd = cgGetNamedParameter(fragmentProgram, "material.kd");
	CGparameter ks = cgGetNamedParameter(fragmentProgram, "material.ks");
	CGparameter shiness = cgGetNamedParameter(fragmentProgram, "material.shiness");
	CGparameter ambient = cgGetNamedParameter(fragmentProgram, "globalAmbient");
	CGparameter light0_pos = cgGetNamedParameter(fragmentProgram, "lights[0].pos");
	CGparameter light0_color = cgGetNamedParameter(fragmentProgram, "lights[0].color");
	CGparameter light0_kc = cgGetNamedParameter(fragmentProgram, "lights[0].kC");
	CGparameter light0_kl = cgGetNamedParameter(fragmentProgram, "lights[0].kL");
	CGparameter light0_kq = cgGetNamedParameter(fragmentProgram, "lights[0].kQ");
	CGparameter light0_direction = cgGetNamedParameter(fragmentProgram, "lights[0].direction");
	CGparameter light0_innerCone = cgGetNamedParameter(fragmentProgram, "lights[0].cosInnerCone");
	CGparameter light0_outerCone = cgGetNamedParameter(fragmentProgram, "lights[0].cosOuterCone");
	CGparameter eyePosition = cgGetNamedParameter(fragmentProgram, "eyePosition");

	cgSetParameter3f(ambient, 0.4, 0.4, 0.4);
	cgSetParameter3f(light0_pos, 5 * sin(-0.4), 1.5, 5 * cos(-0.4));
	cgSetParameter3f(light0_color, 1, 1, 1);
	cgSetParameter1f(light0_kc, 1.0f);
	cgSetParameter1f(light0_kl, 0.01f);
	cgSetParameter1f(light0_kq, 0.001f);
	cgSetParameter3f(light0_direction, -5 * sin(-0.4), -1.5, -5 * cos(-0.4));
	cgSetParameter1f(light0_innerCone, 0.95);
	cgSetParameter1f(light0_outerCone, 0.85);
	cgSetParameter3f(eyePosition, 0, 0, 13);

	cgSetMatrixParameterfr(mvp, mPlasticMVP);
	cgSetMatrixParameterfr(m, mModelMatrixPlastic);
	cgSetParameter3f(ke, mMaterialPlastic[0], mMaterialPlastic[1], mMaterialPlastic[2]);
	cgSetParameter3f(ka, mMaterialPlastic[4], mMaterialPlastic[5], mMaterialPlastic[6]);
	cgSetParameter3f(kd, mMaterialPlastic[8], mMaterialPlastic[9], mMaterialPlastic[10]);
	cgSetParameter3f(ks, mMaterialPlastic[12], mMaterialPlastic[13], mMaterialPlastic[14]);
	cgSetParameter1f(shiness, mMaterialPlastic[15]);
	cgUpdateProgramParameters(vertexProgram);
	cgUpdateProgramParameters(fragmentProgram);
	glutSolidCone(1.5, 3.5, 30, 30);

	cgSetMatrixParameterfr(mvp, mBrassMVP);
	cgSetMatrixParameterfr(m, mModelBrass);
	cgSetParameter3f(ke, mMaterialBrass[0], mMaterialBrass[1], mMaterialBrass[2]);
	cgSetParameter3f(ka, mMaterialBrass[4], mMaterialBrass[5], mMaterialBrass[6]);
	cgSetParameter3f(kd, mMaterialBrass[8], mMaterialBrass[9], mMaterialBrass[10]);
	cgSetParameter3f(ks, mMaterialBrass[12], mMaterialBrass[13], mMaterialBrass[14]);
	cgSetParameter1f(shiness, mMaterialBrass[15]);
	cgUpdateProgramParameters(vertexProgram);
	cgUpdateProgramParameters(fragmentProgram);
	glutSolidSphere(2.0, 40, 40);

	cgSetMatrixParameterfr(mvp, mModelFloorMVP);
	cgSetMatrixParameterfr(m, mModelFloor);
	cgSetParameter3f(ke, mMaterialEmelrad[0], mMaterialEmelrad[1], mMaterialEmelrad[2]);
	cgSetParameter3f(ka, mMaterialEmelrad[4], mMaterialEmelrad[5], mMaterialEmelrad[6]);
	cgSetParameter3f(kd, mMaterialEmelrad[8], mMaterialEmelrad[9], mMaterialEmelrad[10]);
	cgSetParameter3f(ks, mMaterialEmelrad[12], mMaterialEmelrad[13], mMaterialEmelrad[14]);
	cgSetParameter1f(shiness, mMaterialEmelrad[15]);
	cgUpdateProgramParameters(vertexProgram);
	cgUpdateProgramParameters(fragmentProgram);
	glBegin(GL_QUADS);
	glNormal3f(0, 1, 0);
	glVertex3f(12, -2, -12);
	glVertex3f(-12, -2, -12);
	glVertex3f(-12, -2, 12);
	glVertex3f(12, -2, 12);

	glNormal3f(0, 0, 1);
	glVertex3f(-12, -2, -12);
	glVertex3f(12, -2, -12);
	glVertex3f(12, 10, -12);
	glVertex3f(-12, 10, -12);

	glNormal3f(0, -1, 0);
	glVertex3f(-12, 10, -12);
	glVertex3f(12, 10, -12);
	glVertex3f(12, 10, 12);
	glVertex3f(-12, 10, 12);

	glNormal3f(1, 0, 0);
	glVertex3f(-12, -2, 12);
	glVertex3f(-12, -2, -12);
	glVertex3f(-12, 10, -12);
	glVertex3f(-12, 10, 12);

	glNormal3f(-1, 0, 0);
	glVertex3f(12, -2, -12);
	glVertex3f(12, -2, 12);
	glVertex3f(12, 10, 12);
	glVertex3f(12, 10, -12);
	glEnd();

	ShaderManager::Instance()->DisableShaderProfile(mHandleSpotLightFragment);
	ShaderManager::Instance()->UnBindShader(mHandleSpotLightFragment);

	ShaderManager::Instance()->DisableShaderProfile(mHandleSpotLightVertex);
	ShaderManager::Instance()->UnBindShader(mHandleSpotLightVertex);
}